﻿using Easy.Common.Helper.JWT;
using Easy.Common.Params;
using Easy.Common.Results;
using Easy.Services.Dtos;
using Easy.Services.Entities;
using System.Linq.Expressions;

namespace Easy.Services.Interface
{
    public interface IRoleService
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        long Add(Role role);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="role">实体</param>
        /// <returns>返回结果</returns>
        APIResult Update(Role role);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <param name="tokenModel"></param>
        /// <returns></returns>
        APIResult Delete(long id, TokenModelJwt tokenModel);

        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        Role Get(Expression<Func<Role, bool>> expression);

        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        RolePermissionDTO GetDTO(long id);

        /// <summary>
        /// 存在
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        bool Exist(Expression<Func<Role, bool>> expression);

        /// <summary>
        /// 获取集合
        /// </summary>
        /// <returns></returns>
        List<Role> GetList(Expression<Func<Role, bool>> expression = null);

        /// <summary>
        /// 获取分页
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        APIResult GetPage(PageParam param);

    }
}
